<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>创建会员</title>
$!{include("import_js_css.html")}
</head>
<body>
	$!{include("header.html")}
	<div class="container menu_all">
		<div class="div_search_result">
			<div class="panel-heading panel-result-title">
				<h3 class="panel-title">创建会员</h3>
			</div>
			<div id="div_result_member">
				<form class="form-horizontal" role="form" action="yueyogaAdmin/addMember.jhtml" method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label class="col-lg-1 control-label" style="color: #4da2d4;">个人信息</label>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputName" class="col-sm-1 control-label"><font color="red">*</font>会员姓名</label>
						<div class="col-sm-3">
							<input type="text" class="form-control"  name="name" id="inputName" required>
						</div>
						<label for="inputPhone" class="col-sm-1 control-label"><font color="red">*</font>手机号码</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="phone" id="inputPhone" required>
						</div>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputNameEn" class="col-sm-1 control-label">英文名</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="nameEn" value="${nameEn}" id="inputNameEn">
						</div>
						<label for="txtHomeNumber" class="col-sm-1 control-label">家庭电话</label>
						<div class="col-sm-3">
							<input type="text" class="form-control"  name="homeNumber" id="txtHomeNumber">
						</div>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputSex" class="col-sm-1 control-label">性别</label>
						<div class="col-sm-3">
							<label class="radio-inline">
							<!--#if(sex=='男')-->
							<input type="radio" name="sex" value="男" checked="checked" >男
							<!--#else-->
							<input type="radio" name="sex" value="男" >男
							<!--#end-->
							</label>
							<label class="radio-inline">
							<!--#if(sex==null || sex=='女')-->
							<input type="radio" name="sex" value="女" checked="checked" >女
							<!--#else-->
							<input type="radio" name="sex" value="女" >女
							<!--#end-->
							</label>
						</div>
						<label for="inputEmail" class="col-sm-1 control-label">邮箱</label>
						<div class="col-sm-3">
							<input type="email" class="form-control" name="email" id="inputEmail">
						</div>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputBirthday" class="col-sm-1 control-label">出生日期</label>
						<div class="col-sm-3">
							<div class='input-group date' id='inputBirthday' data-date-format="YYYY-MM-DD">
			                    <input name="birthday" type="text" readonly class="form-control" style="background-color:#fff;" />
			                    <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span>
			                    </span>
			                </div>
						</div>
						<label for="inputQQ" class="col-sm-1 control-label">QQ</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="QQ" id="inputQQ">
						</div>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
							
						<label for="inputWechat" class="col-sm-1 control-label">微信账号</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="wechat" id="inputWechat">
						</div>
						
						<label for="inputWechat" class="col-sm-1 control-label">身份证号码</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="sfzh" id="inputsfzh">
						</div>
						<br /> <br />
						
						<!-- 是否同时购买产品 -->
						<label class="col-sm-1" style="width:80px;"></label>
						
						<label for="memberCardNo" class="col-sm-1 control-label">会员卡号</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="memberCardNo" id="memberCardNo">
						</div>
						
						<label for="buyProductAtSameTime" class="col-sm-1 control-label">同时购买</label>
						<div class="col-sm-3">
							<input type="checkbox" class="form-control" id="buyProductAtSameTime" name="buyProductAtSameTime" checked="checked" value="true" style="float:left;width:20px !important;">
							<div style="float:left;margin-top:4px;height:30px;vertical-align: middle;line-height:30px;">(选中表示同时购买产品)</div>
						</div>
						<br /> <br />

						<hr class="divider"/>
						
						<label class="col-sm-1 control-label" style="color: #4da2d4;">地址信息</label>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputProvince" class="col-sm-1 control-label">所在省</label>
						<div class="col-sm-3">
							<!--#var(Area area,List<Area> areas)-->
							<select id="inputProvince" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="inputProvince">
								<option value="0"> </option>
								<!--#foreach(area in areas)-->
									<option value="${area.areaId}">${area.name}</option>
								<!-- #end -->
							</select>
						</div>
						
						<label for="inputCity" class="col-sm-1 control-label">所在市</label>
						<div class="col-sm-3">
							<select id="inputCity" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="inputCity">
									<option value=""> </option>
							</select>
						</div>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputArea" class="col-sm-1 control-label">所在区</label>
						<div class="col-sm-3">
							<select id="inputArea" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="inputArea">
									<option value=""> </option>
							</select>
						</div>
						
						<label for="inputDomain  input-default" class="col-sm-1 control-label">所在域</label>
						<div class="col-sm-3">
							<select id="inputDomain" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="domainId">
								<option value=""> </option>
							</select>
						</div>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputAddress" class="col-sm-1 control-label">具体地址</label>
						<div class="col-sm-7">
							<input type="text" class="form-control" name="address" id="inputAddress" value="${address}">
						</div>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputCompanyAddress" class="col-sm-1 control-label">公司地址</label>
						<div class="col-sm-7">
							<input type="text" class="form-control" name="companyAddress" id="inputCompanyAddress"  value="${companyAddress}">
						</div>
						<br /> <br />
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputCompany" class="col-sm-1 control-label">工作单位</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="company" id="inputCompany" value="${company}">
						</div>
						<br /> <br />
						
						
						<hr class="divider"/>
						<label class="col-sm-1 control-label" style="color: #4da2d4;">附加信息</label>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="memberStatus" class="col-sm-1 control-label">会员状态</label>
						<div class="col-sm-3">
							<!--#var(Status status, List<Status> memberStatus)-->
							<select id="memberStatus"
								class="selectpicker show-tick" data-width="100%" name="memberStatus">
								<option value=""> </option>
								<!-- #foreach(status in memberStatus) -->
									<option value="${status.code}">${status.name}</option>
								<!-- #end -->
							</select>
						</div>
						
						<label for="memberSubStatus" class="col-sm-1 control-label">子状态</label>
						<div class="col-sm-3">
							<select id="memberSubStatus"
								class="selectpicker show-tick" data-width="100%" name="memberSubStatus">
								<option value=""> </option>
								<!-- #foreach(status in subStatuses) -->
									<option value="${status.code}">${status.name}</option>
								<!-- #end -->
							</select>
						</div>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="marketingChannel" class="col-sm-1 control-label">市场渠道</label>
						<div class="col-sm-3">
							<!--#var(Status status, List<Status> marketingChannels)-->
							<select id="marketingChannel"
								class="selectpicker show-tick" data-width="100%" name="marketingChannel">
								<option value=""> </option>
								<!-- #foreach(status in marketingChannels) -->
									<option value="${status.code}">${status.name}</option>
								<!-- #end -->
							</select>
						</div>
						
						<label for="inputSubMarketingChannel" class="col-sm-1 control-label">子渠道</label>
						<div class="col-sm-3">
							<select id="inputSubMarketingChannel"
								class="selectpicker show-tick" data-width="100%" name="subMarketingChannel">
									<option value=""> </option>
							</select>
						</div>
						<br /><br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="keeperId" class="col-sm-1 control-label">会籍顾问</label>
						<div class="col-sm-3">
							<select id="keeperId"
								class="selectpicker show-tick" data-width="100%" name="keeperId">
								<option value=""> </option>
								<!--#for(GroupUserModel keeper:keepers)-->
								<option value="${keeper.id}">${keeper.name}</option>
								<!--#end-->
							</select>
						</div>
						<label for="inputMarketingSource" class="col-sm-1 control-label">信息来源</label>
						<div class="col-sm-3">
							<select id="inputMarketingSource"
								class="selectpicker show-tick" data-width="100%" name="marketingSource">
								<option value=""> </option>
								<option value="81">电话打入</option>
								<option value="82">主动拜访</option>
								<option value="83">数据库</option>
								<option value="84">线上活动</option>
								<option value="85">线下活动</option>
								<option value="86">其他</option>
							</select>
						</div>
						<br /> <br />
						
						<label class="col-sm-1" style="width:80px;"></label>
						<label for="inputRemarks" class="col-sm-1 control-label">备注</label>
						<div class="col-sm-7">
							<textarea class="form-control noneResize" name="remarks" id="inputRemarks" rows="3">${remarks}</textarea>
						</div>
						<br /> <br /><br /><br /><br />
						<div class="panel-btn-add">
							<button type="submit" class="btn btn-default btn-ade-default">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$(function(){
		var msg = "${msg}";
		if(msg){
			alert(msg);
		}
		
		$("#buyProductAtSameTime").click(function(){
			var me = $(this);
			var checked = me.prop("checked");
			if(checked){
				me.val(true);
			}else {
				me.val(false);
			}
		});
		
		//市区域去掉搜索框
		$("#inputCity").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputArea").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputDomain").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputBirthday").datetimepicker({
			language: "zh-CN",
			pickTime: false
		});
		
		//去掉下拉输入框
		$("#memberStatus").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#memberSubStatus").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#marketingChannel").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputSubMarketingChannel").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		$("#inputMarketingSource").select2({
			width: "100%",
			minimumResultsForSearch: -1
		});
		
		//验证手机文本框只能输入数字
		$("#inputPhone").keyup(function(){
			var comment = $("#inputPhone").val();
			var reg = /^\d+$/;
			if(!reg.test(comment)){
				$("#inputPhone").val("");
			}else{}
		});
		//验证家庭电话只能输入数字
		$("#txtHomeNumber").keyup(function(){
			var comment = $("#txtHomeNumber").val();
			var reg = /^\d+$/;
			if(!reg.test(comment)){
				$("#txtHomeNumber").val("");
			}else{}
		});
		
		//会员状态
		$("#memberStatus").change(function() {
			var value = $(this).select2("val");
			$.post(
				"yueyogaAdmin/substatus.jhtml",
				{"code": value},
				function(response) {
					var res = eval("(" + response + ")");
					if (res.success) {
						var option = null;
						var code = null;
						var name = null;
						var sub = document.getElementById("memberSubStatus");
						sub.options.length=0;
						option = new Option(" ", "");
						sub.options.add(option);
						for(var i=0;i<res.items.length;i++) {
							code = res.items[i].code;
							name = res.items[i].name;
							option = new Option(name, code);
							sub.options.add(option);
						}
					} else {
						alert(res.msg);
					}
				}
			);
		});
		//市场渠道
		$("#marketingChannel").change(function() {
			var value = $(this).select2("val");
			$.post("yueyogaAdmin/substatus.jhtml",
				{"code": value},
				function(response) {
					var res = eval("(" + response + ")");
					if (res.success) {
						var option = null;
						var code = null;
						var name = null;
						var sub = document.getElementById("inputSubMarketingChannel");
						sub.options.length=0;
						option = new Option(" ", "");
						sub.options.add(option);
						for(var i=0;i<res.items.length;i++) {
							code = res.items[i].code;
							name = res.items[i].name;
							option = new Option(name, code);
							sub.options.add(option);
						}
					} else {
						alert(res.msg);
					}
				}
			);
		});
	});
	function searchStatus(){
		var memberStatus=$("#memberStatus").select2("val");
		if(memberStatus!=null&&memberStatus!=""){
			var url = "yueyogaAdmin/substatus.jhtml?code="+memberStatus+"&statusType=substatus";
			$.post(url,function(response){
				if(response.success){
					$("#sonMemberStatus").html(response.val);
				}
			}, "json");
		}
	}
	//省
	$("#inputProvince").change(function() {
		var parentId = $(this).select2("val");
		$.post(
			"yueyogaAdmin/subArea.jhtml",
			{"level": "1", "parentId": parentId},
			function(response) {
				var sub = document.getElementById("inputCity");
				var res = eval("(" + response + ")");
				var id = null;
				var name = null;
				var option = null;
				sub.options.length=0;
				option = new Option(" ", "");
				sub.options.add(option);
				for(var i=0;i<res.items.length;i++) {
					id = res.items[i].areaId;
					name = res.items[i].name;
					option = new Option(name, id);
					sub.options.add(option);
				}
				var sub1 = document.getElementById("inputArea");
				sub1.options.length=0;
				option = new Option(" ", "");
				sub1.options.add(option);
				var sub2 = document.getElementById("inputDomain");
				sub2.options.length=0;
				option = new Option(" ", "");
				sub2.options.add(option);
			}
		);
	});
	
	//市
	$("#inputCity").change(function() {
		var parentId = $(this).select2("val");
		$.post(
			"yueyogaAdmin/subArea.jhtml",
			{"level": "2", "parentId": parentId},
			function(response) {
				var sub = document.getElementById("inputArea");
				var res = eval("(" + response + ")");
				var id = null;
				var name = null;
				var option = null;
				sub.options.length=0;
				option = new Option(" ", "");
				sub.options.add(option);
				for(var i=0;i<res.items.length;i++) {
					id = res.items[i].areaId;
					name = res.items[i].name;
					option = new Option(name, id);
					sub.options.add(option);
				}
				var sub1 = document.getElementById("inputDomain");
				sub1.options.length=0;
				option = new Option(" ", "");
				sub1.options.add(option);
			}
		);
	});
	
	//区
	$("#inputArea").change(function() {
		var parentId = $(this).select2("val");
		$.post(
			"yueyogaAdmin/subArea.jhtml",
			{"level": "3", "parentId": parentId},
			function(response) {
				var sub = document.getElementById("inputDomain");
				var res = eval("(" + response + ")");
				var id = null;
				var name = null;
				var option = null;
				sub.options.length=0;
				option = new Option(" ", "");
				sub.options.add(option);
				for(var i=0;i<res.items.length;i++) {
					id = res.items[i].areaId;
					name = res.items[i].name;
					option = new Option(name, id);
					sub.options.add(option);
				}
			}
		);
	});
</script>
</html>